<layout name="page" />
<block name="content">
	{:widget('page_header/search',array('name'=>'流程管理','search'=>'S'))}
	<!--  功能操作区域  -->
	<div class="operate-panel">
		<div class="btn-group">
			<a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> 移动到 <span class="fa fa-caret-down"></span> </a>
			<ul class="dropdown-menu">
				<foreach name="tag_list" val="vo">
					<li onclick="move_to('{$key}');">
						<a>{$vo}</a>
					</li>
				</foreach>
			</ul>
		</div>
		<a class="btn btn-del" id="btn_del">删除</a>
		<div class="split"></div>
		<a onclick="add()" class="btn">新建</a>
	</div>
	<!-- 功能操作区域结束 -->
	<div class="ul-table">
		<ul>
			<li class="thead">
				<span class="col-2 checkbox">
					<input type="checkbox"class="toggle-select-all" data='id[]' />
				</span>
				<span class="col-25 x2">名称</span>
				<span class="col-10 x1">分组 </span>
				<span class="col-16 x1">文档编号规则</span>
				<span class="col-6 x1">状态</span>
				<span class="col-6 x1">字段管理</span>
			</li>
			<if condition="!empty($list)">
				<li class="no-data">
					没找到数据
				</li>
				<else/>
				<form method="post" action="" name="form_data" id="form_data">
					<foreach name="list" val="vo">
						<li class="tbody" >
							<span class="col-2 checkbox">
								<input  type="checkbox" name="id[]" value="{$vo.id}" />
							</span>
							<span class="col-25 x2"><a href="{:url('edit','id='.$vo['id'])}">{$vo.name}&nbsp;</a></span>
							<span class="col-10 x1" >{$vo.tag_name}&nbsp;</span>
							<span class="col-16 x1">{$vo.doc_no_format }&nbsp;</span>
							<span class="col-6 x1"  >{$vo.is_del|status}&nbsp;</span>
							<span class="col-6 x1"><a class="col-6" href="{:url('Flow/field_manage','row_type='.$vo['id'])}">字段管理</a></span>
						</li>
					</foreach>
				</form>
			</if>
		</ul>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		layui.use(['global'], function() {
			var $ = layui.jquery;

			set_return_url(null);

			$('#btn_add').on('click', function() {
				window.open("{:url('add')}", "_self");
			});

			$('#btn_del').on('click', function() {
				layer.msg('确定要删除吗?', {
					time : 0,
					btn : ['确定', '取消'],
					yes : function(index) {
						var vars = $("#form_data").serialize();
						send_ajax("{:url('del')}", vars, function(ret) {
							if (ret.status) {
								layer.msg(ret.info, function() {
									location.reload(true);
								});
							}
						});
					},
					no : function(index) {
						layer.close(index);
					}
				});
			});
		});

		function move_to(val) {
			var vars = $("#form_data").serialize();
			send_ajax("{:url('move_to')}", "val=" + val + '&' + vars, function(data) {
				if (data.status) {
					layer.msg(data.info, function() {
						location.reload(true);
					});
				} else {
					layer.msg(data.info);
					return false;
				}
			});
		}

	</script>
</block>